﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using GodProject.peoples;

namespace WebGodServer.Database
{
  public class SearchResult
  {
    public Parent Parent { get; set; }

    public Student Child { get; set; }

    public static Expression<Func<SearchResult, bool>> IsMatch()
    {
      return x => x.Child.Age < 20;
    } 

    public override string ToString()
    {
      return string.Format("Parent: ({0}, {1}, {2}, {3}, {4}), Child: ({5}, {6}, {7}, {8}, {9}, {10})",
        Parent.GetType().Name, Parent.Name, Parent.Age, Parent.ChildCount,
        Parent is CoolParent ? (Parent as CoolParent).Money : 0,
        Child.GetType().Name, Child.Name, Child.Sex, Child.Age, Child.Middlename,
        Child is Botan ? (Child as Botan).AverageMark : 0);
    }
  }
}
